<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../lib/layui-v2.5.4/css/layui.css" media="all">
    <link rel="stylesheet" href="../css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">

        <div class="layui-btn-group"><!--data-list-sort-->
            <!--  <button class="layui-btn   layui-btn-radius layui-btn-warm  data-list-sort ">所有类别</button>-->
            <button class="layui-btn   layui-btn-radius layui-btn-danger data-uppxia-sort">下架类别</button>
            <button class="layui-btn   layui-btn-radius layui-btn-normal data-uppweixia-sort">所有类别</button>
            <button class="layui-btn   data-add-btn ">添加类别</button>
        </div>
        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
        <script type="text/html" id="currentTableBar">
            <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">
                下架
            </a>
        </script>

    </div>
</div>


<script src="../lib/layui-v2.5.4/layui.js" charset="utf-8"></script>
<script src="../js/category-manage.js" charset="utf-8"></script>

<div class="site-text" style="margin: 5%; display: none" id="window" target="test123">
    <form class="layui-form" id="sort" method="post" lay-filter="example">
        <div class="layui-form-item">
            <label class="layui-form-label">类别名称</label>
            <div class="layui-input-block">
                <input type="text" id="sName" name="sName" lay-verify="title" autocomplete="off" placeholder="请输入类别"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">类别注释</label>
            <div class="layui-input-block">
                <textarea id="sRemark" lay-verify="required" name="sRemark" placeholder="请输入内容"
                          class="layui-textarea"></textarea>
            </div>
        </div>
         

        <div class="layui-form-item">                       
            <div class="layui-input-block">
                <button lay-submit="" lay-filter="sortAdd" class="layui-btn layui-btn-normal tijiao">提交</button>
                     
            </div>
        </div>


    </form>
</div>

<script src="../lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>
<script>
    function getValues() {
        var ssName = $("#sName").val();
        var data = {"ssName": ssName};
        return data;
    }

    layui.use(['layer'], function () {
        var layer = layui.layer;
        $(function () {
            $("#sName").blur(function () {
                var data = getValues();
                if (data.ssName == "") {
                    layer.msg("请输入部门名称");
                    return;
                }
                axios.get('/api/sort/querySortByName', {
                    params: {
                        ssName: data.ssName
                    }
                })
                    .then(function (response) {
                        if (response.data.ss > 0) {
                            layer.msg("类别已存在，请勿重复添加！");
                            return;
                        }
                    })
                    .catch(function (error) {
                    })
                    .then(function () {
                    });
            });
            $("#sRemark").blur(function () {
                var data = getValues();
                if (data.spRemark == "") {
                    layer.msg("请输入部门描述");
                    return;
                }
            });
        });
    })

</script>


<!--<form class="layui-form" id="test" id="add" style="display:none">
    <div class="layui-form-item">
        <label class="layui-form-label">类别名称</label>
        <div class="layui-input-block">
            <input id="sName" type="text" name="title" required  lay-verify="required" placeholder="请输入" autocomplete="on" class="layui-input" id="username" style="width:100px">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label" >类别注释</label>
        <div class="layui-input-block">
            <textarea id="sremark" lay-verify="required" name="desc" placeholder="请输入内容" class="layui-textarea"></textarea>
        </div>
    </div>
</form>-->


</body>
</html>